package com.uyghur.tp;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.RequestAware;

import javax.servlet.ServletContext;
import java.util.Date;
import java.util.Map;

/**
 * Created by AUser on 2015-12-21 021.
 */
public class Adiljan extends ActionSupport implements RequestAware {

    private Map<String, Object> requestMap;

    public String index() throws Exception {
        System.out.println("index...");
        ActionContext.getContext().put("namec","hap");
        requestMap.put("namer", "阿迪力江。亚森");
        requestMap.put("req", ServletActionContext.getRequest());
        return SUCCESS;
    }

    public String sinak() throws Exception {
        System.out.println("sinak...");

        String[] array = "1,5,6,9,8".split(",");
        requestMap.put("aaa", array);
        requestMap.put("count", 50);
        requestMap.put("time", new Date());
        return SUCCESS;
    }


    @Override
    public void setRequest(Map<String, Object> map) {
        this.requestMap = map;
    }

    public String getName() {
        return "Adiljan";
    }
}
